16IQ

Technical details

Show code
library(GeoPressureR)
library(leaflet)
library(leaflet.extras)
library(raster)
library(dplyr)
library(ggplot2)
library(kableExtra)
library(plotly)
library(GeoLocTools)
setupGeolocation()
knitr::opts_chunk$set(echo = FALSE)
load(paste0("../data/1_pressure/", params$gdl_id, "_pressure_prob.Rdata"))
load(paste0("../data/2_light/", params$gdl_id, "_light_prob.Rdata"))
load(paste0("../data/3_static/", params$gdl_id, "_static_prob.Rdata"))
load(paste0("../data/4_basic_graph/", params$gdl_id, "_basic_graph.Rdata"))
load(paste0("../data/5_wind_graph/", params$gdl_id, "_wind_graph.Rdata"))
col <- rep(RColorBrewer::brewer.pal(8, "Dark2"), times = ceiling(max(pam$sta$sta_id) / 8))

Settings used

All the results produced here are generated with (1) the raw geolocator data, (2) the labeled files of pressure and light and (3) the parameters listed below.

Show code
kable(gpr) %>% scroll_box(width = "100%")
gdl_id keep crop_start crop_end thr_dur extent_N extent_W extent_S extent_E map_scale map_max_sample map_margin prob_map_s prob_map_s_calib prob_map_thr shift_k kernel_adjust calib_lon calib_lat calib_1_start calib_1_end calib_2_start calib_2_end calib_2_lon calib_2_lat prob_light_w thr_prob_percentile thr_gs thr_as RingNo scientific_name common_name mass wing_span Color sta_id_winter
16IQ 2 2016-07-01 2017-01-28 18:10:00 0 51 -18 5 16 4 300 30 1 1.3 0.9 0 1.4 8.68364 46.5427 2016-07-01 2016-09-13 NA NA NA NA 0.09 0.95 120 100 N566640 Oenanthe oenanthe Northern wheatear NA NA #19D3F3 21

Pressure timeserie

The labeling of pressure data is illustrated with this figure. The black dots indicates the pressure datapoint not considered in the matching. Each stationary period is illustrated by a different colored line.

Show code
pressure_na <- pam$pressure %>%
  mutate(obs = ifelse(isoutlier | sta_id == 0, NA, obs))
p <- ggplot() +
  geom_line(data = pam$pressure, aes(x = date, y = obs), colour = "grey") +
  # geom_point(data = subset(pam$pressure, isoutlier), aes(x = date, y = obs), colour = "black") +
  # geom_line(data = pressure_na, aes(x = date, y = obs, color = factor(sta_id)), size = 0.5) +
  geom_line(data = do.call("rbind", shortest_path_timeserie) %>% filter(sta_id > 0), aes(x = date, y = pressure0, col = factor(sta_id))) +
  theme_bw() +
  scale_colour_manual(values = col) +
  scale_y_continuous(name = "Pressure(hPa)")

ggplotly(p, dynamicTicks = T) %>% layout(showlegend = F)

Pressure calibration

Show code
pressure_ts_bind <- do.call("rbind", shortest_path_timeserie) %>%
  filter(!is.na(sta_id))

pam$pressure %>%
  left_join(pressure_ts_bind %>% dplyr::select(c("date", "pressure0")), by = "date") %>%
  mutate(diff = ifelse(is.na(pressure0), 0, obs - pressure0)) %>%
  filter(sta_id > 0 & !isoutlier) %>%
  group_by(sta_id) %>%
  mutate(sta_id = paste0(sta_id, " (SD=", round(sd(diff), 2), " ; N=", n(), ")")) %>%
  ggplot(aes(x = diff)) +
  geom_histogram(aes(y = (..count..) / tapply(..count.., ..PANEL.., sum)[..PANEL..]), binwidth = .2) +
  facet_wrap(~sta_id) +
  scale_x_continuous(name = "Pressure Geolocator - best match ERA5 (hPa)") +
  scale_y_continuous(name = "Normalized histogram")

Light

Show code
raw_geolight <- pam$light %>%
  transmute(
    Date = date,
    Light = obs
  )
lightImage(tagdata = raw_geolight, offset = 0)
tsimagePoints(twl$twilight,
  offset = 0, pch = 16, cex = 1.2,
  col = ifelse(twl$deleted, "grey20", ifelse(twl$rise, "firebrick", "cornflowerblue"))
)
abline(v = gpr$calib_2_start, lty = 1, col = "firebrick", lwd = 1.5)
abline(v = gpr$calib_1_start, lty = 1, col = "firebrick", lwd = 1.5)
abline(v = gpr$calib_2_end, lty = 2, col = "firebrick", lwd = 1.5)
abline(v = gpr$calib_1_end, lty = 2, col = "firebrick", lwd = 1.5)

Show code
hist(z, freq = F)
lines(fit_z, col = "red")

The probability map resulting from light data alone can be seen below.

Show code
li_s <- list()
l <- leaflet(width = "100%") %>%
  addProviderTiles(providers$Stamen.TerrainBackground) %>%
  addFullscreenControl()
for (i_r in seq_len(length(light_prob))) {
  i_s <- metadata(light_prob[[i_r]])$sta_id
  info <- pam$sta[pam$sta$sta_id == i_s, ]
  info_str <- paste0(i_s, " | ", info$start, "->", info$end)
  li_s <- append(li_s, info_str)
  l <- l %>% addRasterImage(light_prob[[i_r]], opacity = 0.8, colors = "OrRd", group = info_str)
}
l %>%
  addCircles(lng = gpr$calib_lon, lat = gpr$calib_lat, color = "black", opacity = 1) %>%
  addLayersControl(
    overlayGroups = li_s,
    options = layersControlOptions(collapsed = FALSE)
  ) %>%
  hideGroup(tail(li_s, length(li_s) - 1))

Light vs Pressure

We can compare light and pressure location at long stationary stopover (>5 days). By assuming the best match of the pressure to be the truth, we can plot the histogram of the zenith angle and compare to the fit of kernel density at the calibration site.

Show code
 raw_geolight <- pam$light %>%
    transmute(
      Date = date,
      Light = obs
    )
 dur <- unlist(lapply(pressure_prob, function(x) difftime(metadata(x)$temporal_extent[2],metadata(x)$temporal_extent[1], units = "days" )))
  long_id <- which(dur>5)

  par(mfrow = c(2, 3))
  for (i_s in long_id){
    twl_fl <- twl %>%
      filter(!deleted) %>%
      filter(twilight>shortest_path_timeserie[[i_s]]$date[1] & twilight<tail(shortest_path_timeserie[[i_s]]$date,1))
    sun <-  solar(twl_fl$twilight)
    z_i <- refracted(zenith(sun, shortest_path_timeserie[[i_s]]$lon[1], shortest_path_timeserie[[i_s]]$lat[1]))
    hist(z_i, freq = F, main = paste0("sta_id=",i_s, " | ",nrow(twl_fl),"twls"))
    lines(fit_z, col = "red")
    xlab("Zenith angle")
  }

Similarly, we can plot the line of sunrise/sunset at the best match of pressure (yellow line) and compare to the raw and labeled light data.

Show code
  lightImage(
    tagdata = raw_geolight,
    offset = gpr$shift_k / 60 / 60
  )
  tsimagePoints(twl$twilight,
                offset = gpr$shift_k / 60 / 60, pch = 16, cex = 1.2,
                col = ifelse(twl$deleted, "grey20", ifelse(twl$rise, "firebrick", "cornflowerblue"))
  )
  for (ts in shortest_path_timeserie){
    twl_fl <- twl %>%
      filter(twilight>ts$date[1] & twilight<tail(ts$date,1))
    if (nrow(twl_fl)>0){
    tsimageDeploymentLines(twl_fl$twilight,
                           lon = ts$lon[1], ts$lat[1],
                           offset = gpr$shift_k / 60 / 60, lwd = 3,col = adjustcolor("orange", alpha.f = 0.5))
      
    }
  }

Stationay period information

Show code
read_csv(paste0("../reports/figure_print/table_transition/transition_", params$gdl_id, ".csv")) %>% kable() %>% scroll_box(width = "100%")
…1 sta_id_s sta_id_t flight_duration as_m as_s gs_m gs_s ws_m ws_s dist_m dist_s ws_m_support ws_m_drift start_flight end_flight sunrise sunset as_sp gs_sp ws_sp dist_sp ws_sp_support ws_sp_drift alt_min alt_max alt_mean alt_med alt_sumdabsdiff alt_sumposdiff gdl_id
1 1 2 3.0 37.08885 15.48453 36.44027 15.386209 7.118515 0.7572995 109.32080 46.15863 0.0409361 7.118397 2016-09-12 18:00:00 2016-09-12 21:00:00 2016-09-13 04:35:12 2016-09-12 18:13:03 32.824490 31.63740 7.114727 94.91220 -0.4093685 7.102940 2038.85795 4249.6979 3540.3050 4064.5223 3238.5651 2210.8399 16IQ
2 2 3 4.0 37.58059 13.14256 31.27040 12.953496 11.460933 0.9302699 125.08162 51.81399 -4.8465865 10.385740 2016-09-13 18:00:00 2016-09-13 22:00:00 2016-09-14 04:40:20 2016-09-13 18:14:25 31.051718 25.43909 10.757868 101.75635 -3.9571048 10.003651 2099.89492 3885.5487 3176.5380 3022.0178 2866.8032 972.3402 16IQ
3 3 4 0.5 32.85011 18.94894 31.92803 24.670824 10.757430 2.5719742 15.96402 12.33541 0.8768402 10.721634 2016-09-14 03:30:00 2016-09-14 04:00:00 2016-09-14 04:41:20 2016-09-13 18:16:34 32.433124 39.16539 10.355787 19.58270 7.5227494 7.116922 2579.22290 2881.6171 2730.4200 2730.4200 302.3942 0.0000 16IQ
4 4 5 2.5 34.33540 16.59299 39.04883 15.559596 15.424782 5.6813221 97.62207 38.89899 7.4754513 13.492276 2016-09-14 18:30:00 2016-09-14 21:00:00 2016-09-15 04:46:51 2016-09-14 18:15:36 28.720097 33.30968 14.322265 83.27421 7.3524917 12.290978 914.86577 2508.7662 1724.1304 1815.2973 2732.2431 1138.3426 16IQ
5 5 6 1.0 36.09962 16.37735 39.13690 19.225319 15.149421 11.4244919 39.13690 19.22532 5.8515042 13.973720 2016-09-15 01:30:00 2016-09-15 02:30:00 2016-09-15 04:47:51 2016-09-14 18:19:20 22.351863 19.66879 16.535138 19.66879 4.0842993 16.022774 518.29271 1412.8103 952.2536 925.6578 1381.6701 487.1525 16IQ
6 6 7 2.5 42.32883 18.58214 38.82818 17.108284 6.207005 3.3487909 97.07046 42.77071 -3.1623349 5.341025 2016-09-15 19:00:00 2016-09-15 21:30:00 2016-09-16 04:49:34 2016-09-15 18:18:23 26.190352 22.22587 4.388702 55.56467 -3.8847680 2.041883 315.83312 899.0733 538.3774 506.7137 2073.1680 1205.5361 16IQ
7 7 8 0.5 30.86716 23.28980 29.96778 25.062446 3.857361 2.9342593 14.98389 12.53122 -0.6646187 3.799673 2016-09-16 07:30:00 2016-09-16 08:00:00 2016-09-16 04:49:34 2016-09-15 18:17:54 3.196778 0.00000 3.196778 0.00000 NA NA 233.26855 457.7046 345.4866 345.4866 224.4361 0.0000 16IQ
8 8 9 13.5 37.87521 6.73726 65.56797 5.209439 33.625773 2.7703386 885.16761 70.32743 30.4670068 14.228638 2016-09-17 18:00:00 2016-09-18 07:30:00 2016-09-18 05:00:23 2016-09-17 18:14:04 36.098523 63.92211 35.892599 862.94855 31.8450983 16.558031 70.48249 1476.0783 743.4512 759.0612 8829.4352 4327.2766 16IQ
9 9 10 2.0 33.93267 15.74667 35.31510 16.288515 7.034018 3.5031906 70.63020 32.57703 2.0558822 6.726868 2016-09-18 19:00:00 2016-09-18 21:00:00 2016-09-19 05:00:29 2016-09-18 18:09:58 26.038501 29.91094 4.835239 59.82189 4.0125869 2.697904 -93.84836 1189.0247 353.4827 317.5212 2478.8236 1195.9506 16IQ
10 10 11 2.5 32.82377 15.80523 34.24428 17.783013 6.665090 3.9558371 85.61069 44.45753 2.0396739 6.345325 2016-09-19 20:30:00 2016-09-19 23:00:00 2016-09-20 05:03:32 2016-09-19 18:07:10 22.587714 28.57697 6.696223 71.44242 6.1461671 2.657824 813.64783 1497.1830 1171.8246 1186.9080 1110.8499 213.6574 16IQ
11 11 12 1.0 34.64428 14.75161 34.71879 15.039239 6.535938 1.8787186 34.71879 15.03924 0.6896343 6.499453 2016-09-22 01:30:00 2016-09-22 02:30:00 2016-09-22 05:05:12 2016-09-21 18:05:56 27.628612 27.73859 6.075331 27.73859 0.7750759 6.025687 489.27037 668.0212 602.0915 648.9830 178.7508 0.0000 16IQ
12 12 13 1.5 31.47952 14.62411 30.82213 16.088285 6.569254 2.0233494 46.23319 24.13243 0.0356587 6.569157 2016-09-23 19:30:00 2016-09-23 21:00:00 2016-09-24 05:06:54 2016-09-23 18:02:53 32.851941 36.98249 6.213741 55.47373 4.4218882 4.365487 368.63401 1133.9144 650.3265 549.3787 1381.4182 765.2804 16IQ
13 13 14 1.0 35.68034 17.09562 32.99510 17.143920 5.668659 2.2742101 32.99510 17.14392 -2.3075666 5.177724 2016-09-24 03:00:00 2016-09-24 04:00:00 2016-09-24 05:07:54 2016-09-23 18:02:44 22.867140 22.78728 3.572653 22.78728 0.2000607 3.567047 603.09992 1475.3680 1114.6142 1265.3746 872.2680 872.2680 16IQ
14 14 15 10.5 60.58563 12.43562 63.81798 13.572737 7.819881 2.6613278 670.08881 142.51374 3.6295965 6.926512 2016-10-02 18:30:00 2016-10-03 05:00:00 2016-10-03 05:19:21 2016-10-02 17:50:53 41.797102 48.81643 10.822838 512.57247 7.7144069 7.590900 411.41539 3525.1762 2719.3652 3125.8606 6377.2713 2614.3111 16IQ
15 15 16 11.5 37.83741 11.17303 34.15254 14.311066 9.607799 10.6555008 392.75419 164.57726 -2.5322289 9.268097 2016-10-03 17:30:00 2016-10-04 05:00:00 2016-10-04 05:16:30 2016-10-03 17:54:58 25.287382 29.60238 7.566812 340.42741 4.9676076 5.707847 226.61581 1599.6662 789.7310 660.5537 5579.9595 2726.7820 16IQ
16 16 17 11.5 42.60696 16.22213 53.60666 18.279701 17.472061 5.5365263 616.47654 210.21656 12.7185067 11.979670 2016-10-04 18:00:00 2016-10-05 05:30:00 2016-10-05 05:18:24 2016-10-04 17:51:15 36.577595 29.22691 15.285042 336.10942 -4.2781797 14.674117 197.52266 2235.8945 1045.3244 907.4468 8188.2844 4301.7952 16IQ
17 17 18 10.0 38.91966 18.37944 51.71177 17.869762 19.011591 5.9124672 517.11768 178.69762 14.7046596 12.050460 2016-10-05 18:00:00 2016-10-06 04:00:00 2016-10-06 05:26:57 2016-10-05 17:52:48 30.712738 45.11269 19.989959 451.12687 16.5306127 11.239987 395.29340 3467.0079 1823.4529 1520.8623 8445.9436 4089.2364 16IQ
18 18 19 8.0 29.61892 15.67130 35.89684 22.724972 17.874172 7.4241546 287.17476 181.79977 10.1790183 14.692638 2016-10-06 19:00:00 2016-10-07 03:00:00 2016-10-07 05:30:13 2016-10-06 18:01:43 27.945055 50.17790 25.813715 401.42320 23.9472297 9.637326 286.58205 1636.4986 692.5006 503.8918 4113.5428 2044.4760 16IQ
19 19 20 1.0 32.52622 14.54554 35.14452 18.533317 18.759959 2.9770665 35.14452 18.53332 7.5277459 17.183396 2016-10-07 21:00:00 2016-10-07 22:00:00 2016-10-08 05:31:20 2016-10-07 18:05:55 26.397970 38.34644 15.789102 38.34644 13.3375169 8.450230 246.69684 813.6248 436.6578 249.6518 1130.9010 566.9280 16IQ
20 20 21 2.0 35.52607 17.77283 33.86055 18.459284 17.415097 3.9381675 67.72109 36.91857 2.7719700 17.193074 2016-10-08 23:30:00 2016-10-09 01:30:00 2016-10-09 05:30:26 2016-10-08 18:06:15 33.040540 19.18546 18.927401 38.37092 -9.5215077 16.358099 267.34748 490.2704 363.1242 296.9089 792.1669 388.1909 16IQ